package com.magist.manage.copyrights.service.impl;

import java.util.List;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.magist.core.entity.Page;
import com.magist.core.service.SimpleServiceImpl;
import com.magist.manage.copyrights.entity.SupplyContract;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import com.magist.manage.copyrights.dao.AppendixProjectMapper;
import com.magist.manage.copyrights.entity.AppendixProject;
import com.magist.manage.copyrights.service.AppendixProjectService;

@Service
public class AppendixProjectServiceImpl extends SimpleServiceImpl<AppendixProject> implements AppendixProjectService{

	@Autowired
	private AppendixProjectMapper appendixProjectMapper;

	@Override
	public PageInfo<AppendixProject> page(Example example, Page page) {
    	PageHelper.startPage(page.getCurrPage(), page.getLimit());
    	List<AppendixProject> list = this.find(example);
        PageInfo<AppendixProject> pageInfo = new PageInfo(list);
		return pageInfo;
	}

	@Override
	public List<AppendixProject> findByProjectId(String projectId) {
		Example example = new Example(AppendixProject.class);
		Example.Criteria criteria = example.createCriteria();
		criteria.andEqualTo("deleted","F");
		criteria.andEqualTo("projectId",projectId);
		return find(example);
	}
}